package com.gdsdxy.bookshop.service;

import com.gdsdxy.bookshop.dao.BookMapper;
import com.gdsdxy.bookshop.dao.CategoryMapper;
import com.gdsdxy.bookshop.pojo.Book;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookService{
    @Autowired
    BookMapper bookMapper;
    @Autowired
    CategoryMapper categoryMapper;


    /**
     * 功能描述：往书籍表Book表中添加一条记录
     * author:郑静欣
     * @Param
     * @return 返回新增的主键Id
     */
    public Integer addBook(Book book) {
        bookMapper.insert(book);
        return book.getBookid();
    }

    public Integer findCount(Integer bookid){
        Integer count=bookMapper.findCount(bookid);
        return count;
    }

    public Book findById(Integer bookid){
        Book book = bookMapper.selectById(bookid);
        return book;
    }

}
